<?php 
/* 
 * This file is part of TCDB. 
 * 
 * Copyright (C) 2000-2009 
 * Technology Consultant Corps 
 * Grinnell College 
 * Grinnell, IA, 50112 
 * tc@grinnell.edu 
 * 
 * TCDB is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version. 
 * 
 * TCDB is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
 * GNU General Public License for more details. 
 * 
 * You should have received a copy of the GNU General Public License 
 * along with TCDB. If not, see <http://www.gnu.org/licenses/>. 
 * 
 
 ============================================================================= 
 
 * footer.php -- Displays a footer to end each of our pages; closes off HTML
 *               Checks the priveleges of the current user and displays the
 *               appropriate sidebar; 
 *               Displays server time;
 *               Must be called after 'init.php', as it depends on variables 
 *               in the $_SESSION array
 * 
 * Author: Dylan J. Sather
 * Created: 2009-06-04 
 * Last edited: 2009-07-20 
 */ 

// If we don't have a user_id, display the login form
if (!isset($_SESSION["user_id"])) {
    echo "  <form method='post' action='index.php'>
    <div id='login_sidebar'> <!-- LOGIN div -->
      <span class='box_header'>Log In</span><br /> 
      <input type='text' name='login_username' id='login_username' size='10' /><br />
      <input type='password' name='login_password' size='10' /><br />
      <input type='submit' value='Log In' />
    </div> <!-- End LOGIN div -->
  </form>
  \n";

    echo "  <div class='links_sidebar'> <!-- LINKS div -->
    <span class='box_header'>Links</span><br />
    <a href='/tools'>Tools</a><br />
    <a href='/wiki'>TC&nbsp;Wiki</a><br />
    <a href='/map'>Technology&nbsp;Map</a><br />
  </div> <!-- End LINKS div -->";
}

// Otherwise, we have a user_id and we can display the appropriate information
else {

    echo "  <div class='links_sidebar'> <!-- LINKS div -->
    <span class='box_header'>Tools</span><br />
    <a href='index.php'>Home</a><br />
    <a href='update_info.php'>Update&nbsp;Info</a><br />
    <a href='edit_photo.php'>Edit&nbsp;Photo</a><br />
    <a href='combined_timesheet.php'>Combined&nbsp;Time</a><br />
    <a href='/tools'>Tools</a><br />
    <a href='/wiki'>Wiki</a><br />
    <a href='/wiki/TCWiki.WikiWishList'>Wiki&nbsp;Wishlist</a><br />
    <a href='/map'>Technology&nbsp;Map</a><br />
    <a href='index.php?logout=1'>Log&nbsp;Out</a><br />
  </div> <!-- End LINKS div -->

  <div class='links_sidebar'> <!-- TC CORPS LINKS div -->
    <span class='box_header'>TC&nbsp;Corps</span><br />
    <a href='timesheet.php'>Timesheet</a><br />
    <a href='schedule.php'>Schedule</a><br />
    <a href='sub_requests.php'>Sub&nbsp;Requests</a><br />
    <a href='directory.php'>Directory</a><br />
    <a href='combo.php'>Combo</a><br />
    <a href='handbook.php'>Handbook</a><br />
    <a href='docs/mathlan.doc'>MathLan&nbsp;Handbook</a><br />
    <a href='total_hours.php'>Total&nbsp;Hours</a><br />
    <a href='hardware_request.php'>Hardware&nbsp;Request</a><br />
    <a href='https://eetime27.adphc.com/bm9e/applications/wtk/html/ess/logon.jsp'>Etime&nbsp;(HTML)</a><br />
    <a href='https://eetime27.adphc.com/bm9e/logon'>Etime&nbsp;(Java)</a><br />
  </div> <!-- End TC CORPS LINKS div -->";

    // If the user is an admin, display the admin interface
    if ($_SESSION['is_admin']) {
	echo "  <div class='links_sidebar'> <!-- ADMIN LINKS div -->
    <span class='box_header'>Admin</span><br />
    <a href='approve_hours.php'>Approve Hours</a><br />
    <a href='logs.php'>Logs</a><br />
    <a href='timesheets.php'>Timesheets</a><br />
    <a href='announcements.php'>Announcements</a><br />
    <a href='add_users.php'>Add Users</a><br />
    <a href='edit_users.php'>Edit Users</a><br />
    <a href='delete_users.php'>Delete Users</a><br />
    <a href='add_shifts.php'>Add Shifts</a><br />
    <a href='edit_shift.php'>Edit Shifts</a><br />
    <a href='edit_labs.php'>Edit Labs</a><br />
    <a href='edit_department.php'>Edit Department</a><br />
    <a href='import_schedule.php'>Import Schedule</a><br />
    <a href='missed.php'>Missed Shifts</a><br />
    <a href='http://" . $_SERVER['SERVER_NAME'] . "/phpmyadmin/'>phpMyAdmin</a><br />
    <a href='pcardnums.php'>PCard #s</a><br />
    <a href='apply/phpESP'>Application</a><br />
    <a href='sanityCheck.php'>sanityCheck</a><br />
    <a href='awstats/awstats.pl?config=ucdb'>AWStats</a><br />
    <a href='edit_dietary.php'>Edit Dietary</a><br />
    <a href='edit_photo.php'>Edit User Photos</a><br />
    <a href='verify_ip.php'>Session IP Verification</a><br />
    <a href='edit_links.php'>Edit Links</a><br />
  </div> <!-- End ADMIN LINKS div -->\n";
    }
}

// Print server time info (see functions.php)
printServerTime();

// Finally, close connection to DB
$mysqli->close();

?>

</body>

</html>
